package cn.hanna.springcloudalibaba.controller;

import cn.hanna.springcloud.entities.CommonResult;
import cn.hanna.springcloudalibaba.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author smileha
 * @create 2021-10-23 0:38
 * @description
 */
@RestController
public class storageController {

    @Autowired
    private StorageService storageService;

    @PostMapping("/storage/decrease/{id}/{count}")
    public CommonResult decrease(@PathVariable("id") Long productId,
                          @PathVariable("count") Integer count){
        System.out.println("============="+count);
        storageService.decrease(productId,count);
        return new CommonResult(200,"修改库存成功",null);
    }
}
